//
//  TomorrowViewController.m
//  BasketballClub
//
//  Created by lanou3g on 16/1/6.
//  Copyright © 2016年 孙鸿吉. All rights reserved.
//

#import "TomorrowViewController.h"
#import "LiveTableViewCell.h"
#import "LiveHandle.h"
#import "LiveModel.h"
#import <MJRefresh.h>
#import "WebViewController.h"
@interface TomorrowViewController ()<UITableViewDataSource,UITableViewDelegate>

@property(nonatomic,strong)UITableView *tomorrowTableView;
@end

@implementation TomorrowViewController



- (void)viewDidLoad {
    [super viewDidLoad];
     //布局tableView
    self.tomorrowTableView  = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT-148*LAYOUT_SIZE_HEIGHT) style:UITableViewStylePlain];
    [self.view addSubview:self.tomorrowTableView];
    //设置为代理
    self.tomorrowTableView.delegate = self;
    self.tomorrowTableView.dataSource = self;
    //注册cell
    [self.tomorrowTableView registerClass:[LiveTableViewCell class] forCellReuseIdentifier:@"LiveTableViewCellTomorrow"];
    [[LiveHandle sharedLiveHandle] GetTomorrowDataFromNetWorkWithBlock:^(BOOL isFinished) {
        [self.tomorrowTableView reloadData];
        
    }];

    
}




#pragma mark - tableViewDataSoucre
//rows的个数
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return [LiveHandle sharedLiveHandle].liveTomorrowDataArray.count;
}
#pragma mark - cell的创建和重用
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    LiveTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"LiveTableViewCellTomorrow"];
    if ([LiveHandle sharedLiveHandle].liveTomorrowDataArray.count) {
        LiveModel *model =[LiveHandle sharedLiveHandle].liveTomorrowDataArray[indexPath.row];
        [cell setCellDataFromLiveModel:model];
        
           }
    cell.selectionStyle=UITableViewCellSelectionStyleNone;
    return cell;

   
}
#pragma mark  - cell的高度
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    
    return 190*LAYOUT_SIZE_HEIGHT;
}




- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    [LiveHandle sharedLiveHandle].liveTomorrowDataArray = nil;
}










@end
